﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Runtime.Serialization;
using digitwhu.Helper;
using digitwhu.Models;
using digitwhu.Logic.BusinessLogicControl;

namespace digitwhu.Controllers
{
    
    public class NodeController : Controller
    {

        [HttpGet]
        public String Default(int id)
        {
            NodeRepository rep = new NodeRepository();
            NodeStruct node = rep.getNode(id);

            return JsonHelper.JsonSerializer<NodeStruct>(node);
        }

        //宿舍所有居民
        public String GetResident(String dormId)
        {
            return BuildingLogicControl.GetAllDormStudent(dormId);
        }
        //宿舍列表
        public String GetAllDorms()
        {
            NodeRepository rep = new NodeRepository();
            return JsonHelper.JsonSerializer<List<DormStruct>>(rep.getDorms());
        }


    }
}
